package form;

import java.awt.Color;

import javax.swing.JComboBox;

import checker.StringChecker;

public class FormComboBox extends FormInputComponent {
	
	public FormComboBox(String label, JComboBox<String> comboBox, StringChecker inputChecker){
		super(label, comboBox, inputChecker);
	}
	
	@Override
	public String getInput() {
		if(component==null)
			return "";
		return ((JComboBox)component).getSelectedItem().toString();
	}

	@Override
	public void returnUIToDefaultState() {
		if(component!= null)
			((JComboBox)component).setSelectedItem(0);
	}

	@Override
	public void clearUIError() {
		((JComboBox)component).setBackground(Color.white);
	}

	@Override
	public void setInput(String input) {
		if(component!=null)
			((JComboBox)component).setSelectedItem(input);
	}

	@Override
	public void triggerUIError() {
		// TODO Auto-generated method stub
		((JComboBox)component).setBackground(Color.pink);
	}

}
